# -*- coding: utf-8 -*-
# @Time    : 2021/1/5 上午9:19
# @Author  : tgy


class Solution:
    def largeGroupPositions(self, s):
        ...
        chars = list(s)
        results = []
        tmp_len = 1
        # index = 0
        for i in range(1, len(chars)):
            ...
            if chars[i] == chars[i - 1]:
                tmp_len += 1
            else:
                if tmp_len >= 3:
                    results.append([index, index + tmp_len - 1])
                tmp_len = 1
                index = i

        if tmp_len >= 3:
            results.append([index, index + tmp_len - 1])

        return results


if __name__ == '__main__':
    ...
    solution = Solution()
    results = solution.largeGroupPositions('abcdddeeeeaabbbcd')
    print(results)
